/**
 * @description国际化使用igrid，滚动加载方式
 * 
 * @since 2012-12-22
 */
Ccay.Module.define("ccay.i18n.ListI18n",function(page,$S){
	page.ready=function(){	
		var gridOption = {
			height:370, //滚动加载不能做高度自适应
			percentWidth:true, //列百分比显示
			editMode: true, // 是否可编辑
			editPermission: "Service$I18n.Manage$update|Service$I18n.Manage$create", // 可编辑权限“|”或，“,”与
			rowEdit : true, // 行编辑
			lazyLoad: true, // 滚动加载
			cacheData: true, // 是否缓存数据
			cacheKey: ["i18nId"], // 缓存key
			rowRender: "rowSpan", // 列分组
			wrap:true, // 单元格是否换行显示
			columns:[
			 	 {columnType: "select",multi: true},
			 	 {field : 'i18nId',header : "",hidden:true},
			     {field: 'i18nKey' , width: '30%', header:"ccay.i18n.label.key",rowSpan: true,rule: {required: true,maxlength:50}},
			     {field: 'i18nContent' , width: '30%', header: "ccay.i18n.label.content",rule: {required: true,maxlength:1000}},
				 {field: 'i18nLanguage' , cssName:"center", width: '10%',header: "ccay.i18n.label.language",type:"enum",editorOp: {conf:{multi: false}}, format:{service:'FN:ccay.i18n.ListI18n.languageData',valueField: "id", displayField: "text"}},
				 {field: 'isPublic' , width: '10%', header: "ccay.i18n.label.public",type:'bool', format:{htmlView: false}},
				 {field: 'i18nRemark' , width: '20%',header: "ccay.i18n.label.remark",type:"textarea",editorOp:{width:"120px", height:"50px"}}
			],
		    ajax: {
		    	url: 'services/ccay/resource/i18n/list/range/{0}/{1}'
		    },
		    operation: {
		    	search: {
		    		btn: '#btnSearch',
					panel: '#i18nSearch'
		    	},
		    	del: {
		    		btn: '#btnDel',
		    		undoBtn: '#btnUndoDel'
		    	},
		    	insert: {
		    		btn: '#btnAdd',
		    		copy: true, // 是否复制添加
		    		clear: ['i18nId'], // 清除id
		    		defaultRow:{'i18nKey':workspaceVO.envBean.appName+".",'i18nLanguage':workspaceVO.currentLanguage,'isPublic':"1"} // 默认添加的行数据
		    	},
		    	save: {
		    		btn: '#btnSave',
		    		ajax: {
		    			url: "services/ccay/resource/i18n/batch"
		    		}
		    	}
		    }
	    };
	    
	    $S("#i18nIgrid").igrid(gridOption);		
	};	
	
	page.languageData =	function (){		 
		return [{id:"zh_CN",text:$i18n("ccay.common.label.lang.chinese")},{id:"en_US",text:$i18n("ccay.common.label.lang.english")}];	 
	};
});
